/*
 * Copyright (c) 2007-2020 西安交通信息投资营运有限公司 版权所有
 */

package com.xci.edu.core.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.github.lvyanyang.core.BaseEntity;
import com.github.lvyanyang.core.Const;
import com.github.lvyanyang.core.XCI;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import java.util.Date;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * 学员培训日志
 * @author 张谦 zhangqian@xci96716.com
 * @since 2020-11-25 09:35:56
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(description = "学员培训日志")
public class EduStudentTrainLog extends BaseEntity {
    /**
     * 主键
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @ExcelIgnore
    @Excel(name = "主键", width = 20d)
    @ApiModelProperty(value = "主键", position = 1)
    private Long id;

    /**
     * 学员主键
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @NotNull(message = "学员主键不能为空")
    @ExcelIgnore
    @Excel(name = "学员主键", width = 20d)
    @ApiModelProperty(value = "学员主键", required = true, position = 2)
    private Long studentId;

    /**
     * 学员姓名
     */
    @NotBlank(message = "学员姓名不能为空")
    @Length(max = 50, message = "学员姓名长度不能超过{max}个字符")
    @Excel(name = "学员姓名", width = 20d)
    @ApiModelProperty(value = "学员姓名", required = true, position = 3)
    private String studentName;

    /**
     * 操作时间
     */
    @NotNull(message = "操作时间不能为空")
    @Excel(name = "操作时间", width = 20d, exportFormat = Const.DEFAULT_DATETIME_PATTERN)
    @ApiModelProperty(value = "操作时间", required = true, position = 4)
    private Date operateDateTime;

    /**
     * 操作日期
     */
    @NotNull(message = "操作日期不能为空")
    @Excel(name = "操作日期", width = 15d, exportFormat = Const.DEFAULT_DATE_PATTERN)
    @ApiModelProperty(value = "操作日期", required = true, position = 5)
    private Date operateDate;

    /**
     * 操作日期文本(yyyy-MM-dd)
     */
    @ApiModelProperty(value = "培训开始日期", required = true, position = 7)
    private String operateDateText;

    public String getOperateDateText() {
        return XCI.formatDate(operateDate);
    }

    /**
     * 培训消息
     */
    @NotBlank(message = "培训消息不能为空")
    @Length(max = 500, message = "培训消息长度不能超过{max}个字符")
    @Excel(name = "培训消息", width = 20d)
    @ApiModelProperty(value = "培训消息", required = true, position = 6)
    private String msg;

}